home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Online / News / Thor / rexx / AddUser.thor < prev    next >
Encoding:
Text File  |  1996-11-11  |  2.0 KB  |  81 lines

  1. /* $VER: AddUser.thor v1.2 (20.12.94)
  2.  *
  3.  * by Magne Ã˜stlyngen
  4.  *
  5.  * Adds the sender of the current message to the user database.
  6.  */
  7.  
  8. options results
  9.  
  10. p = ' ' || address() || ' ' || show('P',,)
  11. thorport = pos(' THOR.',p)
  12.  
  13. if thorport > 0 then thorport = word(substr(p,thorport+1),1)
  14. else
  15. do
  16.     say 'No THOR port found!'
  17.     exit 10
  18. end
  19.  
  20. if ~show('p', 'BBSREAD') then do
  21.     address command
  22.         "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  23.         "WaitForPort BBSREAD"
  24. end
  25.  
  26. address(thorport)
  27.  
  28.  
  29. CURRENTMSG STEM msg
  30. if rc~=0 then do
  31.     REQUESTNOTIFY '"CURRENTMSG failed: '||THOR.LASTERROR||'"' '"_Ok"'
  32.     exit
  33. end
  34.  
  35. address BBSREAD
  36. READBRMESSAGE '"'||msg.bbsname||'"' '"'||msg.confname||'"' msg.msgnr HEADSTEM head
  37. if rc~=0 then do
  38.     address(thorport)
  39.     REQUESTNOTIFY '"READBRMESSAGE failed: '||BBSREAD.LASTERROR||'"' '"_Ok"'
  40.     exit
  41. end
  42.  
  43. if head.fromaddr = 'HEAD.FROMADDR' then head.fromaddr = ""
  44.  
  45. address(thorport)
  46.  
  47. REQUESTSTRING 'TITLE="Enter Name:" BT="_Ok|_Cancel" ID="'||head.fromname||'" MAXCHARS=100'
  48. if rc = 0 then head.fromname = result
  49.  
  50. REQUESTSTRING 'TITLE="Enter Address:" BT="_Ok|_Cancel" ID="'||head.fromaddr||'" MAXCHARS=100'
  51. if rc = 0 then head.fromaddr = result
  52.  
  53. wbu.comment.1 = ""
  54. REQUESTSTRING 'TITLE="Enter Comment:" BT="_Ok|_Cancel" MAXCHARS=100'
  55. if rc = 0 then wbu.comment.1 = result
  56.  
  57. wbu.alias = ""
  58. REQUESTSTRING 'TITLE="Enter Alias:" BT="_Ok|_Cancel" MAXCHARS=100'
  59. if rc = 0 then wbu.alias = result
  60.  
  61. REQUESTNOTIFY '"Name : '||head.fromname||'\nAddr : '||head.fromaddr||'\nComnt: '||wbu.comment.1||'\nAlias: '||wbu.alias||'\n\nAdd this user?"' '"_Yes|_No"'
  62. if rc~=0 then do
  63.     REQUESTNOTIFY '"REQUESTNOTIFY failed: '||THOR.LASTERROR||'"' '"_Ok"'
  64.     exit
  65. end
  66. if result~=0 then do
  67.     wbu.name = head.fromname
  68.     wbu.address = head.fromaddr
  69.     if wbu.comment.1 = "" then wbu.comment.count = 0; else wbu.comment.count = 1
  70.  
  71.     address BBSREAD
  72.     WRITEBRUSER '"'||msg.bbsname||'"' STEM wbu ONLYIFEXIST
  73.     if rc~=0 then do
  74.         address(thorport)
  75.         REQUESTNOTIFY '"WRITEBRUSER failed: '||BBSREAD.LASTERROR||'"' '"_Ok"'
  76.         exit
  77.     end
  78. end
  79.  
  80. exit
  81.